package Helper;

// custom exception
public class GameException extends Exception
{
	/**
	 * Constructs an exception
	 * @param code - error cose
	 * @param err_str - error message
	 */
	public GameException(int code, String err_str)
	{
		super();
		error_code = code;
		error_string = errors[code] + err_str;
	}	
	
	/**
	 * 
	 * @return the error message
	 */
	public String getError()
	{
		return error_string;
	}
	
	/**
	 * 
	 * @return the error code
	 */
	public int getErrorCode()
	{
		return error_code;
	}
		
	String error_string;
	int error_code;
	private static final long serialVersionUID = 7180180550052142087L;
	
	// TODO: change errors?
	private static final String[] errors = {
		"No error", /* 0 */		
		"SQL error: " /* 1 */,
		"File not found: " /* 2 */,
		"Failed to read file: " /* 3 */,
		"Failed to search web: " /* 4 */,
		"Class not found: " /* 5 */,
		"Unknown error"
	};
}
